Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Fix math-constant (FURB152) #4049

Merged
merged 5 commits into from
Jul 14, 2024
Merged

Conversation

echoix
Copy link
Member

@echoix echoix commented Jul 14, 2024

Ruff rule: https://docs.astral.sh/ruff/rules/math-constant/

The rule finds hard-coded constants like pi, tau, e, and replaces it with the constants from math.

Two files are affected. One seems unused (a test.py that isn't run as tests), and a test file in imagery. Since the complete test file seemed to use two decimal points, I reverted and added a per-file-ignore. I made it in a separate commit so it would be possible to see what it looks like with the change.

@echoix echoix added this to the 8.5.0 milestone Jul 14, 2024
@echoix echoix requested a review from ninsbl July 14, 2024 12:02
@github-actions github-actions bot added Python Related code is in Python module display labels Jul 14, 2024
@echoix echoix enabled auto-merge (squash) July 14, 2024 12:07
@echoix
Copy link
Member Author

echoix commented Jul 14, 2024

@ninsbl Do you have a preference between these two for the next PR: Fixing the INT001, INT002, and INT003 (the translated string is formatted before getting passed to gettext), or fixing 2148 string formatting with printf. Some of the INT errors use percent formatting.

@echoix
Copy link
Member Author

echoix commented Jul 14, 2024

I think I answered myself. To prevent useless fixes (and conflicts), I'll solve the gettext errors before, and they maybe won't have to convert to printf afterwards

@echoix echoix merged commit 1936cf0 into OSGeo:main Jul 14, 2024
27 checks passed
@echoix echoix deleted the fix-math-constant branch July 14, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display module Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants